<template>
  <el-dialog
    ref="commentDialogRef"
    :visible="dialogVisible"
    :before-close="handleClose"
    :class="{'mobile-el-dialog':showMobilePage}"
    modal-append-to-body
    class="small-common-dialog-size batch-dialog"
  >
    <div class="title">
      <el-image :src="tipIcon" class="tip-icon"/>
      <div class="title-text">请确认结算方式</div>
    </div>
    <div class="content">
      <div :class="{'selected': settleType === 1}" class="radio">
        <el-image :src="settleIcon1" class="settle-icon"/>
        <div class="text">
          <el-radio :label="1" v-model="settleType">按账号单独发起</el-radio>
          <div class="tip tip-1">相同账号+下单平台+成本来源+供应商</div>
        </div>
      </div>
      <div :class="{'selected': settleType === 2}" class="radio">
        <el-image :src="settleIcon2" class="settle-icon"/>
        <div class="text">
          <el-radio :label="2" v-model="settleType">合并合作运营方发起</el-radio>
          <div class="tip tip-2">合并相同合作运营方+成本来源+供应商</div>
        </div>
      </div>
    </div>
    <div class="footer-action-btn">
      <el-button type="primary" size="small" @click="handleSubmit">确认</el-button>
      <el-button type="primary" class="cancel-btn-style" size="small" style="margin-left: 16px" @click="handleClose">取消</el-button>
    </div>
  </el-dialog>
</template>

<script>
import SelectCustomUser from '@/views/legal/process/model/selectCustomUser';
import upAttachment from '@/components/Common/upAttachment/index';
import tipIcon from '@/assets/customer/tip_icon.png';
import settleIcon1 from '@/assets/todo/settle-icon1.png';
import settleIcon2 from '@/assets/todo/settle-icon2.png';
import { mapState } from 'vuex';

export default {
  name: 'CommentDialog',
  components: {
    SelectCustomUser,
    upAttachment
  },
  data() {
    return {
      settleIcon1,
      settleIcon2,
      tipIcon,
      ids: '',
      dialogVisible: false,
      settleType: 1// 1、按账号单独发起 2、合并合作运营方发起
    };
  },
  computed: {
    ...mapState({
      'showMobilePage': state => state.app.showMobilePage
    })
  },
  methods: {
    openDialog() {
      this.dialogVisible = true;
    },
    handleSubmit() {
      this.$emit('handleSubmit', this.settleType);
      this.handleClose();
    },
    handleClose() {
      this.dialogVisible = false;
      this.settleType = 1;
    }
  }
};
</script>

<style scoped lang="scss">
.batch-dialog {
  ::v-deep {
    .el-dialog {
      width: 380px !important;
    }
    .el-dialog__body {
      padding: 0 0 24px 0 !important;
    }
  }
}
.title {
  display: flex;
  align-items: center;
  height: 48px;
  padding: 13px 24px;
  background: #FFF2EB;
  border-radius: 8px 8px 0px 0px;
  .tip-icon {
    width: 24px;
    height: 24px;
    margin-right: 12px;
    >img {
      width: 100%;
      height: 100%;
    }
  }
  .title-text {
    font-size: 16px;
    font-family: PingFang SC, PingFang SC-Medium;
    font-weight: bold;
    text-align: left;
    color: #333333;
    line-height: 20px;
  }
}
.content {
  padding: 16px 16px 8px 16px;
  .radio {
    display: flex;
    align-items: flex-start;
    padding: 8px;
    .text {
      width: 100%;
      ::v-deep .el-radio__label {
        color: #666666;
      }
    }
    margin-bottom: 8px;
  }
  .selected {
    background: #f3f5fb;
    border-radius: 8px;
  }
  .settle-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    margin:5px 8px 0 0;
    >img {
      width: 100%;
      height: 100%;
    }
  }
}
.tip {
  padding: 8px 0 7px 18px;
  margin-top: 4px;
  border-radius: 4px;
  font-size: 12px;
  color: #838791;
  background: #fafbff;
  border: 1px solid #e6edff;
}
.footer-action-btn {
  display: flex;
  justify-content: center;
}
</style>
